package br.com.felix.clearcase.command;

import java.text.SimpleDateFormat;
import java.util.Date;

import br.com.felix.easyclearcase.EasyClearCaseFile;
import br.com.felix.easyclearcase.EasyClearCaseFile.ClearCaseStatus;

/**
 * This command lists all files that were created in the vob after a specified date.
 * */
public class ListCreatedAfterDate extends ClearToolCommand {
	
	private Date date;
	private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

	/**
	 * Instantiates a new command.
	 * @param path is the folder to be searched.
	 * @param date is the date that files must have been created after.
	 * */
	public ListCreatedAfterDate(EasyClearCaseFile path, Date date){
		this.file = path;
		this.date = date;
	}
	
	/**
	 * @see ClearToolCommand#toCommandLine()
	 * */
	@Override
	public String toCommandLine() {
		return "cleartool find \""+file.getAbsolutePath()+"\" -type f -version created_since("+sdf.format(date)+") -print";
	}

	@Override
	public String getCommandName() {
		return "List files created after date";
	}

	@Override
	public ClearCaseStatus getStatusAfterExecution() {
		return null;
	}
}
